#include <usb_media.h>
#include <stdio.h>
#include <stdlib.h>


static inline void
print_usb_media_list()
{
    puts("------usb media list beg------");
    usb_media_print_list();
    puts("------usb media list end------\n");
}

void um_add_hdlr(const struct usb_media *um)
{
    printf("UM_ADD: um_root: %s, syncup enabled: %d\n", um->um_root, um->syncup_enabled);
    print_usb_media_list();
}

void um_rm_hdlr(const struct usb_media *um)
{
    printf("UM_REMOVE: um_root: %s, syncup enabled: %d\n", um->um_root, um->syncup_enabled);
    print_usb_media_list();
}

int main()
{
    usb_media_register_event_handler(UM_ADD, um_add_hdlr);
    usb_media_register_event_handler(UM_REMOVE, um_rm_hdlr);
    usb_media_start_monitor();
    getchar();
    usb_media_stop_monitor();
    return 0;
}
